Re: [SQL] Date

Поиск
Список
Период
Сортировка
От Herouth Maoz
Тема Re: [SQL] Date
Дата
Msg-id l03110706b1c8f014f080@[147.233.159.109]
обсуждение исходный текст
Ответ на Date  (Chairudin Sentosa Harjo <tsg@dnet.net.id>)
Список pgsql-sql
At 12:10 +0300 on 8/7/98, Chairudin Sentosa Harjo wrote:


> I need help with date.
>
> create table blah
> (
>   custnum int,
>    startdate date,
>    enddate date
> );
>
> How do I get the "real date" to insert to startdate when
> the data is entered?
>
> insert into blah
> (custnum, startdate, enddate)
> values
> (001,???,'NULL');
>
> I need a way to fill in the '???' field.
> In oracle I could use
> select sysdate from dual;

First, I recommend that you use datetime, not date. Date is a limited type,
and has less options.

That said, you can use either:

insert into blah
(custnum, startdate, enddate)
values
(001, 'now', null);

Or

values
(001, current_date, null);

See the manpage "pgbuiltin".

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



В списке pgsql-sql по дате отправления:

Предыдущее
От: Chairudin Sentosa Harjo
Дата:
Сообщение: Date
Следующее
От: "Stephen Horton"
Дата:
Сообщение: Newby Postgres questions